﻿using SSAT.Utils;

namespace SSAT.Commands
{
    internal sealed class ConnectToServerCommand : CommandBase
    {
        private readonly Action _connectMethod;

        public override string DisplayName
        {
            get
            {
                return CommandsResources.ConnectToServerCommandDisplayName;
            }
        }

        public ConnectToServerCommand(Action connectMethod)
        {
            Verification.CheckArgumentForNull(connectMethod, "connectMethod");
            _connectMethod = connectMethod;
        }

        public override void Execute()
        {
            if (_connectMethod != null)
            {
                _connectMethod.Invoke();
            }
        }
    }
}
